Image forming apparatus correcting the density of image information according to the type of manuscript

ABSTRACT

An image forming apparatus, which converts the analog image read in lines into a digital image containing the density information in pixels, comprises a histogram creating circuit that converts the density information on the target pixels in the digital image into multiple values and creates a histogram having the frequency for each density, a peak density value determining circuit that determines the peak density values of two points at which the frequency of the density histogram peaks, a computing circuit that computes a reference value for density correction of the digital image on the basis of the frequency of the peak density value, a circuit that judges the type of the image on the basis of the features of the density histogram, a circuit that corrects the reference value on the basis of the judged type of the image, and a circuit that corrects the density information about the digital image on the basis of the corrected reference value.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates to an image forming apparatus, such as a digitalcopying machine, which determines a reference value used for gradationcorrection from a density histogram of an image, when performinggradation correction on the target image, and carries out the gradationcorrection using the reference value.

2. Description of the Related Art

Besides conventional analog image forming apparatuses, such aselectronic copying machines, digital image forming apparatuses haverecently been popularized. In this connection, to realize an automaticexposure function generally found with the analog copying machines, thatis, the function of obtaining the optimum picture quality by sensing themanuscript density with a sensor and on the basis of the sensed density,changing the brightness of the exposure lamp, automatic densityadjustment using a density histogram has been proposed as described inJpn. Pat. Appln. KOKOKU Publication No. 64-6588 and Jpn. Pat. Appln.KOKOKU Publication No. 3-30143.

When a reference value for gradation correction is computed from thedensity histogram of the target image, however, the reference valuecomputed changes, depending on whether the target image is a photographor character, or with the change of the density distribution in thedensity histogram. This causes the problem that error correction isunstable in forming an image of a manuscript having photograph areas andcharacter areas intermingled or an image whose density changes greatly.

SUMMARY OF THE INVENTION

The object of the present invention is to provide an image formingapparatus capable of performing an optimum gradation correction on thebasis of a reference value for gradation correction obtained from adensity histogram of a target image.

The foregoing object is accomplished by providing an image formingapparatus which reads an image in lines containing the densityinformation on each pixel with converting means, the image formingapparatus comprising: means for a density histogram having the frequencyof each density; means for determining a peak density value at which thefrequency of the density histogram peaks; means for computing areference value for density correction of the digital image on the basisof the frequency of the peak density value; means for judging the typeof the image on the basis of the features of the density histogram;means for correcting the reference value on the basis of the judged typeof the image; and means for correcting the density information about thedigital image on the basis of the reference value corrected at thecorrecting means.

With the above configuration of the invention, because a densityhistogram is obtained and on the basis of the histogram, the referencevalue for density correction is determined, it is possible to provide animage forming apparatus which is capable of performing stable densitycorrection on the basis of the reference value according to the density,even when the density distribution varies from one place to another onthe image. Furthermore, on the basis of the density histogram, the typeof image (e.g., character or photograph) is judged and according to thetype, the reference value for density correction is adjusted each timethe type is judged, so that it is possible to provide an image formingapparatus capable of making natural density adjustment even when animage of a manuscript having photographs and character intermingled isformed.

Additional objects and advantages of the invention will be set forth inthe description which follows, and in part will be obvious from thedescription, or may be learned by practice of the invention. The objectsand advantages of the invention may be realized and obtained by means ofthe instrumentalities and combinations particularly pointed out in theappended claims.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of the specification, illustrate presently preferred embodiments ofthe invention and, together with the general description given above andthe detailed description of the preferred embodiments given below, serveto explain the principles of the invention.

FIG. 1 is a block diagram of a range correction circuit in an imageforming apparatus according to an embodiment of the present invention;

FIG. 2 is a schematic sectional view of the image forming apparatusaccording to the present invention;

FIG. 3 is a block diagram of the control system in the image formingapparatus of the invention;

FIG. 4 is a block diagram of the image processing section in the imageforming apparatus of the invention;

FIG. 5 is a block diagram of the processing sections corresponding tothe respective means constituting the range correction circuit;

FIG. 6 is a circuit diagram of the white peak position sensing sectionand the white width judging section;

FIG. 7 is a circuit diagram of the black peak position sensing section;

FIG. 8 is a circuit diagram of the reference value computing section;

FIG. 9 is a circuit diagram of the character frequency judging section,manuscript type judging section, and judgment result changeover section;

FIG. 10 is a circuit diagram of the reference-value select section,reference-value change amount control section, erroneous judgmentsuppressing section, and range correction section;

FIG. 11 is a circuit diagram of the reset judging section;

FIG. 12A shows processing timing in the range correction process;

FIG. 12B is a diagram to help explain the operation of the rangecorrection circuit;

FIGS. 13A and 13B show the processing cycles in the reference valuecreating section at the time of entering a non-image section;

FIG. 14 is a histogram with the number of values given to the inputimage signal being 8;

FIG. 15 is a histogram with only one peak and the number of values givento the input image signal being 8;

FIG. 16 is a histogram with three peaks and, the number of values givento the input image signal being 8;

FIG. 17 shows the peak position of the histogram and the frequency oflocal peaks on the right and left sides;

FIG. 18 is a diagram to help explain the change of the reference valuecomputed at regular intervals;

FIGS. 19A and 19B are flowcharts to help explain the operation ofcorrecting the reference value; and

FIGS. 20A to 20D and FIGS. 21A and 21B are timing charts explaining theoperation of judgment correction in the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Hereinafter, referring to the accompanying drawings, an embodiment ofthe present invention will be explained.

FIG. 2 shows a schematic configuration of a digital copying machine asan example of an image forming apparatus according to the invention. Thedigital copying machine is largely composed of a scanner section 1acting as reading means for optically reading the image information on amanuscript, and a printer section 2 acting as image forming means forforming an image on paper by electronic photography according to theimage signal supplied from the scanner section 1 or from an externaldevice (not shown).

The scanner section 1 contains a manuscript table 11 on which amanuscript to be copied is put, a manuscript cover 12 that can be openedand closed freely and is used to hold down the manuscript placed on themanuscript table 11, a fluorescent lamp 13 serving as a light sourceilluminating the manuscript on the manuscript table 11, and a CCD linesensor 14 serving as photoelectric conversion means forphotoelectrically converting the reflected light from the manuscript onwhich light is projected from the fluorescent lamp 13. The fluorescentlamp 13 is provided with a lamp heater (not shown) acting as heatingmeans for heating the lamp's tube wall to a constant temperature. Themanuscript table 11 is provided with a manuscript glass 91 on which amanuscript is placed and a manuscript scale 90 against which amanuscript is pressed to measure the position of the manuscript.

Provided on one side of the fluorescent lamp 13 is a reflector 15 forcausing the light from the fluorescent lamp 13 to concentrateefficiently on the manuscript. Between the fluorescent lamp 13 and theline sensor 14, there are provided a plurality of mirrors 16, 17, and 18for bending the optical path through which the reflected light from themanuscript passes, and a lens unit 19 for forcing the reflected light tofocus on the light-receiving face of the line sensor 14.

By reciprocating motion of the scanning system composed of thefluorescent lamp 13 and mirrors 16 to 18 along the bottom surface of themanuscript table 11 in the direction of arrow "a", the manuscript on themanuscript table 11 undergoes exposure scanning. In this case, themirrors 17, 18 are designed to move at half the speed of the mirror 16to maintain the optical path length.

The reflected light from the manuscript by scanning of the scanningsystem, that is, the reflected light from the manuscript by illuminationof the fluorescent lamp 13, is reflected by the mirrors 16 to 18, andthen passes through the lens unit 19, is directed to the line sensor 14,where an image of the manuscript is formed on the light-receiving faceof the line sensor 14.

The scanning unit 20 is composed of the fluorescent lamp 13, line sensor14, mirrors 16 to 18, and lens unit 19. The fluorescent lamp 13,reflector 15 and mirror 16 are provided on a first carriage 21, whereasthe mirrors 17, 18 are provided on a second carriage 22. Each of thesecarriages 21, 22 is moved by a motor (not shown).

The printer section 2 is cylindrical. It is designed to be capable ofbeing rotated by, for example, a motor (not shown) in the desireddirection to be charged to the desired potential. It also contains aphotosensitive drum 31 serving as an image retaining member on which anelectrostatic latent image is formed as a result of the beam lightmodulated according to the print data being projected on the drum.

Around the photosensitive drum 31, there are provided a charging unit 32for charging the surface of the photosensitive drum 31, a laser unit 33for projecting a beam light on the surface of the photosensitive drum31, the beam light being modulated according to the print data (theimage information to be copied or outputted), a developing unit 34 fordeveloping the electrostatic latent image formed on the photosensitivedrum 31 by the beam light from the laser unit 33 by causing toner toadhere to the latent image, a transfer unit 35 for transferring thedeveloped toner image on the photosensitive drum 31 onto a sheet ofpaper supplied from a paper feed section 39 explained later, and anexfoliating unit 36 for exfoliating the sheet adhering to thephotosensitive drum 31.

Around the photosensitive drum 31 and on the downstream side of theexfoliating unit 36, there are a cleaner unit 37 for removing theremaining toner on the surface of the photosensitive drum 31 and anerasing unit 38 for erasing the potential on the photosensitive drum 31for a subsequent image.

Provided between the developing unit 34 and the transfer unit 35 is apaper feed section 39 for feeding sheets of paper to which the tonerimage formed on the photosensitive drum 31 is to be transferred towardbetween the photosensitive drum 31 and the transfer unit 35.

In the stage next to the exfoliating unit 36 on the side toward whichthe toner-image-transferred sheet is peeled by the exfoliating unit 36from the photosensitive drum 31, there is provided a transport unit 41that carries the exfoliated sheet of paper to a fixing unit 40.

The sheet to which the toner image has been fixed at the fixing unit 40is discharged by a discharge roller 42 to a discharge tray 43.

FIG. 3 shows a schematic configuration of the control system of thedigital copying machine. As seen from the figure, the apparatus iscontrolled by a main CPU 11, a control panel CPU 12, a scanner CPU 13,and a printer CPU 14.

The main CPU 11 communicates with the control panel CPU 12, scanner 13,and printer CPU 14 and controls them.

The control panel CPU 12 is connected to a ROM 15 and a RAM 16 and onthe basis of the data stored in them, senses the switches on a controlpanel 17 serving as select means, turns on and off the LEDs, andcontrols the indicator.

The scanner CPU 13 is controlled through communication with the main CPU11 and on the basis of the data stored in the ROM 21 and RAM 22,controls mechanical controllers 23 including motors and solenoids (notshown), as well as an auto document feeder 24, an editor 25 acting as acoordinate input unit, an analog/digital converting circuit 26, ashading correction circuit 27, and a line memory 28.

The printer CPU 14 is controlled through communication with the main CPU11 and on the basis of the data stored in the ROM 31 and RAM 32,controls mechanical controllers 33 including motors and solenoids (notshown), as well as a sorter 34, an LCF (Large Capacity Feeder) 35, alaser modulation circuit 36, and a laser drive circuit 37.

Connected to the main CPU 11 are a ROM 41, a RAM 42, a data changeoverand buffer memory 43, an image processing section 44, acompression/expansion circuit 45, a page memory circuit 46, a display47, a display memory 48, a personal computer 49, a printer controller50, a display font ROM 51, a print font ROM 52, a compression memory 53,a hard disk drive 54, an optical disk drive 55, a facsimile adaptor 56,and an I/F controller 57.

The ROM 41 stores a program for the predetermined operation of the mainCPU 1.

The RAM 42 stores the data determined by the ROM 41 and the main CPU 1.

The data changeover and buffer memory 43 switches between where to sendthe image data read at the scanner section 1 and which data to send tothe printer section 2 and performs data buffering.

The image processing section 44 effects the image processing of imagedata.

The compression/expansion circuit 45 performs the compression/expansionof image data.

The page memory circuit 46 stores image data page by page.

The display memory 48 stores the image data to appear on the display 47.

The printer controller 50 develops the code data supplied from thepersonal computer 49 into printable image data via the printer section2.

The display font ROM 51 is a memory in which the font data used in thedisplay memory 48 is stored.

The print font ROM 52 causes the page memory 46 to store the print datafrom the personal computer 49 or the numerals or symbols correspondingto the desired inputs.

The compression memory 53 stores the data compressed by thecompression/expansion circuit 45.

FIG. 4 shows a schematic arrangement of the image processing section 44.The image processing section 44 comprises a range correction circuit 82,a timing signal generating section 83, a clock generating section 84, apicture quality improving circuit 85, an enlarging/reducing circuit 86,and a gradation processing circuit 87.

The range correction circuit 82, which is part of the feature of theinvention and will be explained in detail later, acts as imageinformation correction means and corrects the range of density.

The timing signal generating section 83 generates timing signals andsupplies them to a histogram creation circuit 80, the range correctioncircuit 32, the image improving circuit 85, the enlarging/reducingcircuit 86, and the gradation processing circuit 87.

The clock generating section 84 generates clock signals and suppliesthem to the timing signal generating section 83, histogram creationcircuit 80, range correction circuit 82, picture quality improvingcircuit 85, enlarging/reducing circuit 86, and gradation processingcircuit 87.

The picture quality improving circuit 85 improves the picture quality onthe basis of the corrected range from the range correction circuit 82.

The enlarging/reducing circuit 86 enlarges and reduces thepicture-quality-improved image data supplied from the image improvingcircuit 85.

The gradation processing circuit 87 performs the gradation processing ofthe image data supplied from the enlarging/reducing circuit 86.

FIG. 1 shows a schematic configuration of the range correction circuit82. The range correction circuit 82, which is part of the feature of theinvention, comprises histogram creation means 91, peak positiondetermining means 92, reference value computing means 93, image typejudging means 94, reference value correction means 95, and gradationcorrection means 96. The gradation correction means 96 corrects thedensity range of the image data on the basis of the correction referencevalue.

The histogram creation means 91 creates a density histogram(hereinafter, referred to as a histogram) from the data supplied fromthe scanner section 1.

The peak position determining means 92 senses and determines two peakpositions in the histogram created at the histogram creation means 91.

The image type judging means 94 judges whether the image is a photographor characters.

The reference value correction means 95 corrects the reference valuefrom the reference value computing means 93 on the basis of the imagejudging result from the image type judging means 94.

The gradation correction means 96 performs a gradation correction whichcorrects the density range of the image data on the basis of thecorrection reference value from the reference value correction means 95.

FIG. 5 shows the processing sections corresponding to the individualmeans constituting the range correction circuit 82.

Specifically, the histogram creation means 91 is composed of a histogramcreating section 91a, the peak position determining means 92 is made upof a white peak position sensing section 92a and a black peak positionsensing section 92b, the reference value computing means 93 is made upof a reference value computing section 93a and a reset judging section93b, the image type judging means 94 is composed of a white widthjudging section 94a, a character frequency judging section 94b, amanuscript type judging section 94c, and a judging result changeoversection 94d, the reference value correction means 95 is composed of areference value select section 95a, a reference value change amountcontrol section 95b, and an erroneous judgment suppressing section 95c,and the gradation correction means 96 is made up of a range correctionsection 96.

The histogram creation section 91a creates a histogram from the imagedata supplied from the scanner section 1. The image data has beenobtained by converting the analog signal of the density image data intodigital image data (the number of values data) at the A/D convertingcircuit 26. That is, the image data is the digital image data containingthe density information.

The white peak position sensing section 92a senses the white peakposition from the created histogram. The black peak position sensingsection 92b senses the black peak position from the created histogram.

The white width judging section 94a judges the white width from thesensed white peak position signal and the created histogram. Thecharacter frequency judging section 94b judges the character frequencyfrom the sensed white peak position signal, black position signal, andthe created histogram.

The reset judging section 93b judges resetting from the characterfrequency judging result, white peak position signal, and black peakposition signal. When judging that resetting has been done, it willreset the histogram creation section 91a.

The manuscript type judging section 94c judges the type of manuscriptfrom the white width judging result and the character frequency judgingresult. On the basis of the judging result, the judging resultchangeover section 94d switches the image type judging result signalbetween photograph or characters.

The reference value computing section 93a calculates the references forwhite and black from the created histogram, white peak position signal,and black position signal.

The reference value select section 95a selects the reference values forwhite and black from the reference value signal whose reference valuesfor white and black have been calculated and the image type judgingresult signal. The reference value change amount control section 95bcontrols the change amount of the selected reference values for whiteand black. The erroneous judgment suppressing section 95c suppresseserroneous judgment.

The range correction section 96a performs the range correction of theimage data supplied from the scanner section 1 and delayed one line at aline buffer acting as delay means explained later.

FIG. 6 is a circuit diagram of the white peak position sensing section92a and the white width judging section 94a. The white peak positionsensing section 92a is composed of a selector 100, a flip-flop 101, anda white peak enable signal producing circuit 102. The histogram HFcreated at the histogram creation section 91a is inputted to theselector 100. The selector 100 selects the histogram HF according to thewhite peak enable signal and writes the result into the flip-flop 101,which outputs a white peak position signal MFW.

The white width judging section 94a comprises a totalizing circuit 103,an enable signal producing circuit 104 of CR and CL, selectors 105, 106,flip-flops 107, 108, and an AND circuit 109. It produces a signal MFH ofthe white width judging result from the supplied white peak positionsignal MFW and the histogram HF.

FIG. 7 is a circuit diagram of the black peak position sensing section92b, which comprises selectors 110, 111, 112, flip-flops 113, 114, atemporary interim black peak enable signal producing circuit 115, atotalizing circuit 116, an interim peak enable signal producing circuit117, and an OR circuit 118. It produces a black peak position signal MFBfrom the supplied histogram HF.

FIG. 8 is a circuit diagram of the reference value computing section93a, which comprises selectors 120, 121, 122, 123, 124, 125, a -1 enable+1 enable signal producing circuit 126, flip-flops 127, 128, 129, 130, asubtraction circuit 131, a division circuit 132, a white reference valueenable signal producing circuit 133, a black reference value enablesignal producing circuit 134, and condition processing sections 135,136, 137. It produces a white reference value signal MID and a blackreference value signal MAD from the supplied white peak position signalMFW and black peak position signal MFB and histogram HF.

FIG. 9 is a circuit diagram of the character frequency judging section94b, the manuscript type judging section 94c, and the judging resultchangeover section 94d. The character frequency judging section 94b iscomposed of selectors 140, 141, 142, addition circuits 143, 144,flip-flops 145, 146, a WA1 enable signal producing circuit 147, a WA2enable signal producing circuit 148, and a comparing circuit 149. Itproduces a signal CHDS as the character frequency judging result fromthe supplied white peak position signal MFW, black peak position signalMFB, and histogram HF.

The manuscript type judging section 94c is composed of an AND circuit150 and produces a signal DSCA as the manuscript type judging resultfrom the supplied signal CHDS of the character frequency judging resultand signal MFH of the white width judging result. The judging resultchangeover section 94d is composed of a selector 151 and produces animage type judging result signal DSC by switching between a photographand characters in the signal DSCA of the manuscript type judging result.

FIG. 10 is a circuit diagram of the reference value select section 95a,reference value change amount control section 95b, erroneous judgmentsuppressing section 95c, and range correction section 96a.

The reference value select section 95a is composed of addition circuits160, 161, selectors 162, 163, OR circuits 164, 165, flip-flops 166, 167,and an MD1 latch signal producing circuit 168. It produces a whitereference value signal and black reference value signal MAD1 whose whiteand black reference values are selected respectively from the whitereference value signal MID and black reference value signal MAD andimage type judging result signal DSC.

The reference value change amount control section 95b is composed ofcomparing circuits 170, 171, selectors 172, 173, 174, 175, and an MD2select signal producing circuit 176. It produces a white reference valuesignal MID2 and black reference value signal MAD2 whose change amount iscontrolled, from the supplied white reference value signal MID1 andblack reference value signal MAD1.

The erroneous judgment suppressing section 95c is made up of selectors181, 182, flip-flops 183, 184, an MD3 select signal producing circuit185, and an MD3 latch signal producing circuit 186. It produces a whitereference value signal MID3 and black reference value signal MAD3 thatsuppress erroneous judgment, from the supplied white reference valuesignal MID2 and black reference value signal MAD2.

The range correction section 96a is made up of subtraction circuits 190,191, a division circuit 192, and condition processing sections 193, 194.It produces the range-corrected image data IDT0 from the supplied whitereference value signal MID3, the black reference value signal MAD3, andthe image data supplied from the scanner section 1 and delayed one lineat a line buffer explained later.

FIG. 11 is a circuit diagram of the reset judging section 93b. The resetjudging section 93b is composed of a feed non-image portion processingsection 195, a feed image portion processing section 196, a first lineprocessing section 197, a timing producing section 198, a selector 199,and an AND circuit 200. It outputs a reset signal CRST to the histogramcreation section 91a in response to a vertical sync. signal VDEN.

FIG. 12A shows the timing in the range correction process.

In FIG. 12A, the horizontal sync. signal HDEN is composed of an imageportion M and a non-image portion N. In the image portion M, thehistogram creation section 91a and range correction section 96a effectprocessing. In the non-image portion N, a reference value producingsection K effects processing. The reference value producing section Kcomprises the white peak position sensing section 92a, black peaksensing section 92b, reference value computing section 93a, resetjudging section 93b, white width judging section 94a, characterfrequency judging section 94b, manuscript type judging section 94c,judging result changeover section 94d, reference value select section95a, reference value change amount control section 95b, and erroneousjudgment suppressing section 95c.

FIG. 12B is a diagram to help explain the operation of the rangecorrection circuit. In the figure, for the image portion M, thehistogram creation section 91a effects processing and at the same time,the range correction section 96a corrects the image data delayed oneline at the line buffer L. Then, the reference value producing section Keffects processing in the non-image portion N.

FIGS. 13A and 13B show the processing cycles in the reference valueproducing section K when the nonimage portion N is reached. In FIG. 13A,the processing starts at cycle 0. First, the white peak position sensingsection 92a and black peak position sensing section 92b start operationand determine values in cycle 1, cycle 2, and cycle 3 in that order. Theprocessing finishes with the signal CRST outputted from the resetjudging section 93b in cycle 3 and stops in cycle 4. The individualvalues are retained as long as the non-image portion N lasts.

As shown in FIG. 13B, one cycle consists of 20 steps and is expressed bytwo types of codes: binary code BIN<4:0> and signal SHIFT <19:0> codedat a shift register. Here, <4:0> is a symbol meaning 5-bit data based onthe 0-th signal to fourth signal. Hereinafter, the symbol is used in thesame meaning. By combining SYCL<4:0>, SHIFT<19:0>, and BIN<4:0>, thelatch timing for each block is produced.

With such a configuration, the operation of the range correction circuit82 of the present embodiment will be explained.

The histogram creation means 91 gives multiple values to the image dataread at the scanner section 1 by means of, for example, an A/Dconverter, creates a histogram with density on the abscissa and thefrequency of specific density on the ordinate, and outputs a histogramsignal.

FIG. 14 is a histogram with the number of values given to the inputimage signal determined to be 8. The peak position determining means 3determines two peak positions. For example, the shapes of histogram areroughly divided into the following three types:

(1) a histogram with only one peak

(2) a histogram with two peaks

(3) a histogram with three peaks or more

In addition to these three types, there is the following type:

(4) a histogram with more than one hill whose frequency may meet therequirements for peak position

First, a histogram of type (1) with only one peak will be described.

FIG. 15 is a histogram with only one peak and the number of values givento the input signal being 8. Since two peaks, the peak for white andpeak for black, are to be determined, the range in which the white peakis searched for and the range in which the black peak is searched forhave been determined in advance. In FIG. 15, the range of "0" to "4" isdetermined to be the white range and the range of "6" to "7" isdetermined to be the black range.

In FIG. 15, it is in the white side that the peak exists. On the sidewhere the peak exists (the white side in FIG. 15), the peak position isdetermined in the same manner as with a histogram of type (2) with twopeaks. On the side without a peak (the black side in FIG. 15), whatmeets the conditions previously given is determined to be the peakposition. Examples of the conditions are: "a hill with the highestdensity", "a hill with the lowest density", and "a hill whose density isin the middle of the white side (black side) range."

Thus, even when a peak is not determined because the frequency is 0 orthe same in the white side (black side) range, a peak position can bedetermined for each of the white side and the black side. For instance,in the histogram of FIG. 15, if the white side has "a hill with thehighest density" and the black side has "a hill with the lowestdensity", the white peak position will be 3 and the black peak positionwill be 6.

Now, a histogram of type (2) with two peaks will be described.

FIG. 14 is a histogram with two peaks and the number of values given tothe input image signal being 8. Since two peaks, the peak for the whiteside and the peak for the black side, are to be determined, the range inwhich a peak on the white side is searched for and the range in which apeak on the black side is searched for have been determined in advance.In FIG. 14, the range of "0" to "4" is determined to be the white rangeand the range of "6" to "7" is determined to be the black range. In theranges, what meets the conditions previously given is determined to bethe peak position. Examples of the conditions are: "a hill whosefrequency is the highest in the white side (black side) range", "a hillwhose frequency is the n-th highest in the white side (black side)range", "an adjacent hill on the right of the hill whose frequency isthe highest in the white side (black side) range", "an adjacent hill onthe left of the hill whose frequency is the highest in the white side(black side) range", "a hill whose frequency is closest to n % of thehill whose frequency is the highest in the white side (black side)range", "one with the highest density among the peaks in the white side(black side) range", and "a hill with the lowest density among the peaksin the white side (black side) range."

By combining one or more of these conditions, the peak position isdetermined. A case where there are more than one hill of the samefrequency will be explained later. For instance, in the histogram ofFIG. 14, if both the white side and the black side have "a hill whosefrequency is the highest in the white side (black side) range", thewhite peak position will be 2 and the black peak position will be 6.

Now, a histogram of type (3) with three peaks will be explained.

FIG. 16 is a histogram with three peaks and the number of values givento the input image signal being 8. Since two peaks, the peak for thewhite side and the peak for the black side, are to be determined, therange in which a peak on the white side is searched for and the range inwhich a peak on the black side is searched for have been determined inadvance. In FIG. 16, the range of "0" to "4" is determined to be thewhite range and the range of "6" to "7" is determined to be the blackrange. Three hills that may become peak positions are determined to beA, B, and C in ascending order of density. When there is only one peakin the white side (black side) range (the black side in FIG. 16), a peakposition will be determined as with a histogram of type (2) with twopeaks. When there is more than one peak in the white side (black side)range, what meets the conditions previously given is determined to bethe peak position. Examples of the conditions are: "a hill whosefrequency is the highest", "a hill whose frequency is the n-th highest","a hill whose density is the highest", "a hill whose density is thelowest", "if a hill whose frequency is the second highest has afrequency n % or less of that of the hill whose frequency is thehighest, the hill with the highest frequency will be selected;otherwise, the hill with the highest density will be selected", and "onein the middle of three hills in the white side (black side) range.

By combining one or more of these conditions, a peak position isdetermined. A case where there are more than one hill of the samefrequency will be explained later. In the histogram of FIG. 16, if boththe white side and the black side have "a hill whose frequency is thehighest in the white side (black side) range", the white peak positionwill be 1 of A and the black peak position will be 7 of C.

Now, a histogram of type (4) with more than one hill whose frequency maymeet the requirements for peak position.

When more than one of the same frequency exists as shown in FIG. 15,what meets the conditions previously given will be determined to be thepeak position. Examples of the conditions are: "a hill whose density isthe highest among the peak position candidates", "a hill whose densityis the lowest among the peak position candidates", and "a hill whosedensity is in the middle among the peak position candidates."

In this way, the peak positions are determined.

The reference value computing means 93 calculates a reference value fromthe peak position signal determined at the peak position determiningmeans 92 as described above and the histogram signal produced at thehistogram producing means 91. Both of the white reference value andblack reference value are calculated using the same equation.

FIG. 17 shows the peak position of the histogram and the frequencies ofthe hills on its right and left sides. Here, P indicates the centerdensity value of the peak position and P-1 and P+1 represent the densityof the hill on the left side of P and the density of the hill on theright side of P. H P!, H P-1!, and H P+1! indicate the frequencies of P,P-1, and P+1, respectively. W indicates the density width of the densityhistogram.

The reference value is obtained using the following equations.

If P-1 or P+1 does not exist, the values of fictitious hills will bedetermined under the conditions previously given as follows:

H P-1!=0 or H P+1!=0

H P-1!=H P! or H P+1!=H P!

If H P-1! or H P+1! is larger than H P!,

H P-1!=H P! or H P+1!=H P! will be given.

The reference value K is calculated as follows:

    K=P×W+W/2+(H P+1!-H P-1!)/H P!×W/2

Hereinafter, it is assumed that the white reference value=Kw and theblack reference value=Kb.

By using the above equations, the reference value computing means 93computes a reference value and outputs a reference value signal. Becausethe value of the reference value signal from the reference valuecomputing means 93 is computed at regular intervals previously given, anew reference value K(n) is determined at regular intervals.

When the reference value changes greatly at regular intervals,irregularity is liable to take place in the output image after gradationcorrection. Therefore, the reference value correction means 95 correctsthe reference value of the reference value signal from the referencevalue computing means 93.

The details of the reference value correcting method will be give below.

FIG. 18 shows changes in the reference values Kw(n) and Kb(n) computedat regular intervals (n). The broken lines indicate the reference valuesbefore correction and the solid lines indicate the reference valuesafter correction. Since the reference value suppresses abrupt densitychanges in the output image, it is desirable that the reference valuesshould change smoothly.

The reference value Kw(n), Kb(n) are corrected on the basis of the imagetype judging result signal from the image type judging means 94, thereference value signal from the reference value computing means 93, thephoto image reference value constant previously given, the referencevalue change amount constant, and the offset constant.

Hereinafter, the way of computing a correction reference value K2(n) ofthe reference value K(n) to suppress the amount of change will bedescribed.

First, in correcting the reference value for each of the createdhistograms, the reference value K(n-1) determined in the cycle of thepreceding correction is compared with the reference value K(n) currentlydetermined.

When the reference value reduces sharply below the constant, it will besuppressed to the constant as follows:

If K(n)<K(n-1)-reference value change amount constant,

then K2(n)=K(n-1)-reference value change amount constant

When the reference value increases sharply over the constant, it will besuppressed to the constant as follows:

If K(n)>K(n-1)+reference value change amount constant,

then K2(n)=K(n-1)+reference value change amount constant

If the change of the reference value is smaller than the constant, thereference value need not be corrected.

That is, if K(n-1)-reference value change amountconstant<K(n)<K(n-1)+reference value change amount constant, K2(n)=K(n)will be given.

Then, the determined K2(n) is changed using an offset constant:

K3(n)=K2(n)+offset constant

Furthermore, K3(n) is changed using the image type judging result fromthe image type judging means 94.

When the image type judging result signal from the image type judgingmeans 94 is associated with photograph judgment, the reference valuewill be used as a photo image constant: K(n)=photo image constant

When the image type judging result signal is associated with characterjudgment, the reference value K3(n) added with the offset constant willbe given:

K(n)=K3(n)

Then, the reference value correction means 95 counts how long thecharacters or photograph as the result of the image type judging resultsignal from the image type judging means 94 lasts, and then corrects thereference value further.

FIGS. 19A and 19B are flowcharts for the reference value correctingoperation. The symbols used are listed below and the operation ofcorrecting them will be explained. The initial values of the judgingresult counter and judging result change flags are PHO=1, PHO1=0, andDSC0=1, respectively.

The respective symbols have the following meanings:

DSC: manuscript judging result

DSC0: the preceding manuscript judging result

PHO: judging result counter

PHO1: judging result change flag

KSTOP: judging result counter threshold value

reg10 3!: reference value correction control register (yes=0/no=1)

Furthermore, the individual reference values are defined as follows:

MID: white reference value before correction

MAD: black reference value before correction

MID0: the preceding white reference value

MAD0: the preceding black reference value

MID2: a white reference value used for gradation correction

MAD2: a black reference value used for gradation correction

When reference value control correction register reg10 3!=1, thefollowing eight judgments (S1 to S8) will be made as the occasiondemands (S1).

The reference value is corrected suitably to produce a white referencevalue and a black reference value, which are used to perform gradationcorrection of the image information (S18).

(1) If (PHO≧KSTOP) and (PHO1=1) (S2),

PHO=PHO and PHO1=PHO1 will be set (S9) and then MID2=MID0 and MAD2=MAD0will be set (S16).

(2) If (PHO≧KSTOP) and (PHO1=0) (S3),

PHO=0 and PHO1=0 will be set (S10) and then MID2=MID and MAD2=MAD willbe set (S16).

(3) If (0<PHO<KSTOP) and (PHO1=0) and (DSC=DSC0) (S4),

PHO=PHO+1 and PHO1=0 will be set (S11) and then MID2=MID0 and MAD2=MADwill be set (S16).

(4) If (0<PHO<KSTOP) and (PHO1=0) and (DSC≠DSC0) (S5),

PHO=1 and PHO1=0 will be set (S12) and then MID2=MID0 and MAD2=MAD willbe set (S16).

(5) If (PHO=0) and (PHO1=0) and (DSC≠DSC0) (S6),

PHO=PHO+1 and PHO1=1 will be set (S13) and then MID2=MID0 and MAD2=MAD0will be set (S17).

(6) If (0<PHO<KSTOP) and (PHO1=1) and (DSC≠=DSC0) (S7),

PHO=0 and PHO1=0 will be set (S14) and then MID2=MID and MAD2=MAD willbe set (S16).

(7) If (0<PHO<KSTOP) and (PHO1=1) and (DSC=DSC0) (S8),

PHO=0+1 and PHO1=1 will be set (S15) and then MID2=MID0 and MAD2=MAD0will be set (S17).

(8) If the case does not come under any one of the above conditions,

PHO=PHO, PHO1=PHO1 will be set and then MID2=MID and MAD2=MAD will beset (S16).

Similarly, if reg10 3!=0,

MID2=MID and MAD2=MAD will be set (S16).

As described above, by correcting the reference value of the imageinformation according to the type of image, not across the board, moreproper gradation correction of image information can be made.

The gradation correction means 96 performs range correction of the imagedata using the corrected reference value signal outputted from thereference value correction means 95 (S18). In this case, the gradationcorrection means 96 makes a correction linearly in the width of 0 to Fon the basis of the calculated white reference value Kw(n) and blackreference value Kb(n).

Namely, the gradation correction means 96 performs gradation correctionof the image signal using the following equation and supplies the outputimage data:

    D2=(D-Kw(n))/(Kb(n)-Kw(n))×FF(hex)

However, when D<Kw(n), D=Kw(n)

when D>Kb(n), D=Kb(n).

The gradation correction means computes a reference value from thehistogram at regular intervals and using the value, effects gradationcorrection.

FIGS. 20A to 20D and FIGS. 21A and 21B are timing charts to help explainthe operation of judgment correction in the present invention.Hereinafter, the judgment correction explained in the flowchart of FIG.19 will be described.

For range correction in the invention, a histogram of the image iscreated for each section (each line), it is judged on the basis of theobtained value whether the manuscript is of character or of photograph,and it is determined what the reference value is, if the manuscript isof character. Because irregularity will occur in the image density ifthe reference value suddenly changes greatly, however, the amount ofchange is suppressed so that the reference value may change little bylittle (reference value change amount control).

In addition to the reference value change amount control by which thereference value is forced to change gradually, the present inventionperforms the process of verifying whether the judging result is correct(judgment correction).

The judgment correction is carried out as follows. The judging resultcontinues to be character and suddenly changes to photograph at aparticular line. In this case, it is doubtful whether the manuscript hasactually changed to a photograph manuscript, and there is a possibilitythat the judging result will return to character after several lines arejudged, because of erroneous judgments. When the judging result changesfrom character to photograph, or vice versa, a flag (PHO1) is set(PHO=1) and the period during which the result remains unchanged iscounted (a PHO is provided as a counter, which counts up the duration).The period is referred to as a monitoring period. Specifically, thejudgment state is monitored by counting up the PHO until the monitoringperiod (PHO) has exceeded the judging result counter threshold (KSTOP)or the judging result has changed again.

The following two cases can be considered, depending on how long themonitoring period (PHO) lasts:

1) Monitoring period (PHO)<Judging result counter threshold (KSTOP)

It is judged that the judgment on the section is temporary, that is, thejudgment is incorrect.

2) Monitoring period (PHO)>Judging result counter threshold (KSTOP)

It is judged that the judgment on the section is correct and has entereda new area.

Furthermore, how the reference value is dealt with according to thesetwo cases will be explained using the following six examples withreference to FIGS. 20A, 20B, 20C, 20D, and FIGS. 21A and 21B.

1) Case of FIG. 20A where the judging result of photograph instantlyreturns to character

monitoring period T1<threshold (KSTOP)

It is judged that the judgment during the monitoring period isincorrect.

Thus, the change of the reference value is stopped at the time a whenthe judging result has changed for the first time and the referencevalue at time a is reserved.

MID2=MID0 (the reference value on the preceding line=the white referencevalue at the time when the judging result has changed)

MAD2=MAD0 (the reference value on the preceding line=the black referencevalue at the time when the judging result has changed)

At the time b when the judging result has returned to character, therecalculated value is used directly as the reference value.

MID2=MID (the white reference value computed on the current line)

MAD2=MAD (the black reference value computed on the current line)

2) Case of FIG. 20B where the judging result of photograph does notreturn to character

monitoring period T2>threshold (KSTOP)

It is judged that the judgment during the monitoring period is correct.

Thus, the change of the reference value at the time a when the judgingresult has changed for the first time is stopped temporarily. Becausethe judging result continues to be photograph even at time b when themonitoring period has exceeded the threshold (KSTOP), the image densitywill not change further, so that the reference value is kept fixed untilthe end of the image has been reached.

MID2=MID0 (the reference value on the preceding line=the white referencevalue at the time when the judging result has changed)

MAD2=MAD0 (the reference value on the preceding line=the black referencevalue at the time when the judging result has changed)

3) Case of FIG. 20C where the judging result of character instantlyreturns to photograph

monitoring period T3<threshold (KSTOP)

It is judged that the judgment (of character) during the monitoringperiod is incorrect.

Thus, the change of the reference value is stopped at the time a whenthe judging result has changed for the first time and the referencevalue at time a is maintained. Because the correct judging result wasphotograph, there is no apparent change in the value even if thereference value is held.

MID2=MID0 (the reference value on the preceding line=the white referencevalue at the time when the judging result has changed)

MAD2=MAD0 (the reference value on the preceding line=the black referencevalue at the time when the judging result has changed)

At the time be when the judging result has returned to photograph, therecalculated value (the fixed value because the reference value is forphotograph) is used directly as the reference value.

MID2=MID (the white reference value computed on the current line)

MAD2=MAD (the black reference value computed on the current line)

4) Case of FIG. 20D where the judging result of character does notreturn to photograph

monitoring period T4>threshold (KSTOP)

It is judged that the judgment during the monitoring period is correct.

Thus, the change of the reference value is stopped at the time a whenthe judging result has changed for the first time and the referencevalue at time a is reserved. Because the judging result shows characterat time b when the monitoring period has exceeded the threshold, theimage density will not change further, so that the reference value iskept fixed until the end of the image has been reached.

MID2=MID0 (the reference value on the preceding line=the white referencevalue at the time when the judging result has changed)

MAD2=MAD0 (the reference value on the preceding line=the black referencevalue at the time when the judging result has changed)

Basically, the process of correcting the reference value is performedaccording to the above four cases. In the case of processing the leadingedge of the image, when the judging result shows photograph, either ofthe following two processes will be carried out, depending on thecondition:

5) Case of FIG. 21A where the leading edge of an image starts with aphotograph and the judging result of photograph instantly returns tocharacter

monitoring period T5<threshold (KSTOP)

It is judged that the judgment of photograph during the monitoringperiod is incorrect.

Thus, at the time b when the judging result has changed to character,the calculation result is used as the reference value,

MID2=MID (the white reference value computed on the current line)

MAD2=MAD (the black reference value computed on the current line)

6) Case of FIG. 21B where the leading edge of an image starts with aphotograph and the judging result of photograph does not return tocharacter

monitoring period T6>threshold (KSTOP)

It is judged that the judgment of photograph is correct and thereference value is fixed completely at the time b when the monitoringperiod has exceeded the threshold.

By performing the process of determining the reference value accordingto the judging processes as described above, it is possible to realizethe density correction of image information more suitable for the typeof manuscript.

As described above, with the embodiment, it is possible to performoptimal gradation of images in real time using density histograms.

As described above in detail, according to the present invention, thereis provided an image forming apparatus capable of performing optimalgradation correction in real time using the reference values ofgradation correction obtained from the density histograms of the targetimage.

Additional advantages and modifications will readily occur to thoseskilled in the art. Therefore, the invention in its broader aspects isnot limited to the specific details, and representative devices shownand described herein. Accordingly, various modifications may be madewithout departing from the spirit or scope of the general inventiveconcept as defined by the appended claims and their equivalents.

What is claimed is:
 1. An image forming apparatus which reads an imagein lines containing density information on each pixel, said imageforming apparatus comprising:means for forming a density histogramhaving a frequency of each density on the basis of the densityinformation about the digital image in a particular area; means fordetermining a peak density value at which the frequency of the densityhistogram peaks; means for computing a reference value for densitycorrection of the digital image on the basis of the frequency of thepeak density value; means for detecting a type of the image on the basisof the density histogram; means for correcting the reference value onthe basis of the detected type of the image; means for correcting thedensity information about the digital image on the basis of thereference value corrected at the correcting means; and means for formingan image on the basis of the corrected density information, wherein thereference value computing means contains means for calculating thereference value using the following equation: the reference value K=(thepeak density value P×(the density width of the density histogram W)+W/2+##EQU1## where the frequency H P+1! is the frequency adjacent to thefrequency H P! on the higher density side in the density histogram andthe frequency H P-1! is the frequency adjacent to the frequency H P! onthe lower density side in the density histogram.
 2. An image formingapparatus according to claim 1, wherein the peak density determiningmeans contains means for pinpointing a white pixel area and a blackpixel area from the density histogram and determining the peak densityvalues for the individual areas, one peak density for each area.
 3. Animage forming apparatus which reads an image in lines containing densityinformation on each pixel, said image forming apparatus comprising:meansfor forming a density histogram having a frequency of each density onthe basis of the density information about the digital image in aparticular area; means for determining a peak density value at which thefrequency of the density histogram peaks; means for computing areference value for density correction of the digital image on the basisof the frequency of the peak density value; means for detecting a typeof the image on the basis of the density histogram; means for correctingthe reference value on the basis of the detected type of the image;means for correcting the density information about the digital image onthe basis of the reference value corrected at the correcting means; andmeans for forming an image on the basis of the corrected densityinformation, wherein the peak density determining means contains meansfor pinpointing a white pixel area and a black pixel area from thedensity histogram and determining the peak density values for theindividual areas, one peak density for each area, wherein the peakdensity determining means contains means that, when either the whitepixel area or the black pixel area in the density histogram has no peakdensity value, determines the highest density value of the pixel area tobe the peak density value.
 4. An image forming apparatus which reads animage in lines containing density information on each pixel, said imageforming apparatus comprising:means for forming a density histogramhaving a frequency of each density on the basis of the densityinformation about the digital image in a particular area; means fordetermining a peak density value at which the frequency of the densityhistogram peaks; means for computing a reference value for densitycorrection of the digital image on the basis of the frequency of thepeak density value; means for detecting a type of the image on the basisof the density histogram; means for correcting the reference value onthe basis of the detected type of the image; means for correcting thedensity information about the digital image on the basis of thereference value corrected at the correcting means; and means for formingan image on the basis of the corrected density information, wherein thepeak density determining means contains means for pinpointing a whitepixel area and a black pixel area from the density histogram anddetermining the peak density values for the individual areas, one peakdensity for each area, wherein the peak density determining meanscontains means that, when either the white pixel area or the black pixelarea in the density histogram has no peak density value, determines thelowest density value of the pixel area to be the peak density value. 5.An image forming apparatus which reads an image in lines containingdensity information on each pixel, said image forming apparatuscomprising:means for forming a density histogram having a frequency ofeach density on the basis of the density information about the digitalimage in a particular area; means for determining a peak density valueat which the frequency of the density histogram peaks; means forcomputing a reference value for density correction of the digital imageon the basis of the frequency of the Peak density value; means fordetecting a type of the image on the basis of the density histogram;means for correcting the reference value on the basis of the detectedtype of the image; means for correcting the density information aboutthe digital image on the basis of the reference value corrected at thecorrecting means; and means for forming an image on the basis of thecorrected density information, wherein the Peak density determiningmeans contains means for pinpointing a white pixel area and a blackpixel area from the density histogram and determining the peak densityvalues for the individual areas, one peak density for each area, whereinthe peak density determining means contains means that, when either thewhite pixel area or the black pixel area in the density histogram has nopeak density value, determines the medium density value of the pixelarea to be the peak density value.
 6. An image forming apparatus whichreads an image in lines containing density information on each pixel,said image forming apparatus comprising:means for forming a densityhistogram having a frequency of each density on the basis of the densityinformation about the digital image in a particular area; means fordetermining a peak density value at which the frequency of the densityhistogram peaks; means for computing a reference value for densitycorrection of the digital image on the basis of the frequency of thepeak density value; means for detecting a type of the image on the basisof the density histogram; means for correcting the reference value onthe basis of the detected type of the image; means for correcting thedensity information about the digital image on the basis of thereference value corrected at the correcting means; and means for formingan image on the basis of the corrected density information, wherein thepeak density determining means contains means for pinpointing a whitepixel area and a black pixel area from the density histogram anddetermining the peak density values for the individual areas, one peakdensity for each area, wherein the peak density determining meanscontains means that, when either the white pixel area or the black pixelarea in the density histogram has a plurality of density values withpeaks, determines the highest density value of the pixel area to be thepeak density value.
 7. An image forming apparatus which reads an imagein lines containing density information on each pixel, said imageforming apparatus comprising:means for forming a density histogramhaving a frequency of each density on the basis of the densityinformation about the digital image in a particular area; means fordetermining a peak density value at which the frequency of the densityhistogram peaks; means for computing a reference value for densitycorrection of the digital image on the basis of the frequency of thePeak density value; means for detecting a type of the image on the basisof the density histogram; means for correcting the reference value onthe basis of the detected type of the image; means for correcting thedensity information about the digital image on the basis of thereference value corrected at the correcting means; and means for formingan image on the basis of the corrected density information, wherein thepeak density determining means contains means for pinpointing a whitepixel area and a black pixel area from the density histogram anddetermining the peak density values for the individual areas, one peakdensity for each area, wherein the peak density determining meanscontains means that, when either the white pixel area or the black pixelarea in the density histogram has a plurality of density values withpeaks, determines the lowest density value of the pixel area to be thepeak density value.
 8. An image forming apparatus which reads an imagein lines containing density information on each pixel, said imageforming apparatus comprising:means for forming a density histogramhaving a frequency of each density on the basis of the densityinformation about the digital image in a particular area; means fordetermining a peak density value at which the frequency of the densityhistogram peaks; means for computing a reference value for densitycorrection of the digital image on the basis of the frequency of thepeak density value; means for detecting a type of the image on the basisof the density histogram; means for correcting the reference value onthe basis of the detected type of the image; means for correcting thedensity information about the digital image on the basis of thereference value corrected at the correcting means; and means for formingan image on the basis of the corrected density information, wherein thepeak density determining means contains means for pinpointing a whitepixel area and a black pixel area from the density histogram anddetermining the peak density values for the individual areas, one peakdensity for each area, wherein the peak density determining meanscontains means that, when either the white pixel area or the black pixelarea in the density histogram has a plurality of density values withpeaks, determines the one of the highest frequency to be the peakdensity value.
 9. An image forming apparatus which reads an image inlines containing density information on each pixel, said image formingapparatus comprising:means for forming a density histogram having afrequency of each density on the basis of the density information aboutthe digital image in a particular area; means for determining a peakdensity value at which the frequency of the density histogram peaks;means for computing a reference value for density correction of thedigital image on the basis of the frequency of the peak density value;means for detecting a type of the image on the basis of the densityhistogram; means for correcting the reference value on the basis of thedetected type of the image; means for correcting the density informationabout the digital image on the basis of the reference value corrected atthe correcting means; and means for forming an image on the basis of thecorrected density information, wherein the peak density determiningmeans contains means for pinpointing a white pixel area and a blackpixel area from the density histogram and determining the peak densityvalues for the individual areas, one peak density for each area, whereinthe peak density determining means contains means that, when either thewhite pixel area or the black pixel area in the density histogram hasthree density values with peaks, determines the middle density to be thepeak density value.
 10. An image forming apparatus which reads an imagein lines containing density information on each pixel, said imageforming apparatus comprising:means for forming a density histogramhaving a frequency of each density on the basis of the densityinformation about the digital image in a particular area; means fordetermining a peak density value at which the frequency of the densityhistogram peaks; means for computing a reference value for densitycorrection of the digital image on the basis of the frequency of thepeak density value; means for detecting a type of the image on the basisof the density histogram; means for correcting the reference value onthe basis of the detected type of the image; means for correcting thedensity information about the digital image on the basis of thereference value corrected at the correcting means; and means for formingan image on the basis of the corrected density information, wherein thepeak density determining means contains means for pinpointing a whitepixel area and a black pixel area from the density histogram anddetermining the Peak density values for the individual areas, one peakdensity for each area, wherein the peak density determining meanscontains means that, when either the white pixel area or the black pixelarea in the density histogram has a plurality of density values withpeaks of the same frequency, determines the highest density value to bethe peak density value.
 11. An image forming apparatus which reads animage in lines containing density information on each pixel, said imageforming apparatus comprising:means for forming a density histogramhaving a frequency of each density on the basis of the densityinformation about the digital image in a particular area; means fordetermining a peak density value at which the frequency of the densityhistogram peaks; means for computing a reference value for densitycorrection of the digital image on the basis of the frequency of thepeak density value; means for detecting a type of the image on the basisof the density histogram; means for correcting the reference value onthe basis of the detected type of the image; means for correcting thedensity information about the digital image on the basis of thereference value corrected at the correcting means; and means for formingan image on the basis of the corrected density information, wherein thepeak density determining means contains means for pinpointing a whitepixel area and a black pixel area from the density histogram anddetermining the peak density values for the individual areas, one peakdensity for each area, wherein the peak density determining meanscontains means that, when either the white pixel area or the black pixelarea in the density histogram has a plurality of density values withpeaks of the same frequency, determines the lowest density value to bethe peak density value.
 12. An image forming apparatus which reads animage in lines containing density information on each pixel, said imageforming apparatus comprising:means for forming a density histogramhaving a frequency of each density on the basis of the densityinformation about the digital image in a particular area; means fordetermining a peak density value at which the frequency of the densityhistogram peaks; means for computing a reference value for densitycorrection of the digital image on the basis of the frequency of thepeak density value; means for detecting a type of the image on the basisof the density histogram; means for correcting the reference value onthe basis of the detected type of the image; means for correcting thedensity information about the digital image on the basis of thereference value corrected at the correcting means; and means for formingan image on the basis of the corrected density information, wherein thepeak density determining means contains means for pinpointing a whitepixel area and a black pixel area from the density histogram anddetermining the peak density values for the individual areas, one peakdensity for each area, wherein the peak density determining meanscontains means that, when either the white pixel area or the black pixelarea in the density histogram has a plurality of density values withpeaks of the same frequency, determines the medium one of them to be thepeak density value.
 13. An image forming apparatus which reads an imagein lines containing density information on each pixel, said imageforming apparatus comprising:means for forming a density histogramhaving a frequency of each density on the basis of the densityinformation about the digital image in a particular area; means fordetermining a peak density value at which the frequency of the densityhistogram peaks; means for computing a reference value for densitycorrection of the digital image on the basis of the frequency of thepeak density value; means for detecting a type of the image on the basisof the density histogram; means for correcting the reference value onthe basis of the detected type of the image; means for correcting thedensity information about the digital image on the basis of thereference value corrected at the correcting means; and means for formingan image on the basis of the corrected density information, wherein thepeak density determining means contains means for pinpointing a whitepixel area and a black pixel area from the density histogram anddetermining the peak density values for the individual areas, one peakdensity for each area, wherein the reference value computing meanscontains means for computing a second reference value for densitycorrection of the digital image at regular intervals on the basis of thefrequency of the peak density value and means for comparing the computedreference value with a third reference value computed a specific periodof time ago, correcting the second reference value so that thedifference may be less than a specific value, and outputting thecorrected second reference value.
 14. An image forming apparatus whichreads an image in lines containing density information on each pixel,said image forming apparatus comprising:means for forming a densityhistogram having a frequency of each density on the basis of the densityinformation about the digital image in a particular area; means fordetermining a peak density value at which the frequency of the densityhistogram peaks; means for computing a reference value for densitycorrection of the digital image on the basis of the frequency of thepeak density value; means for detecting a type of the image on the basisof the density histogram; means for correcting the reference value onthe basis of the detected type of the image; means for correcting thedensity information about the digital image on the basis of thereference value corrected at the correcting means; and means for formingan image on the basis of the corrected density information, wherein thepeak density determining means contains means for pinpointing a whitepixel area and a black pixel area from the density histogram anddetermining the peak density values for the individual areas, one peakdensity for each area, wherein the reference value computing meanscontains means for computing a second reference value for densitycorrection of the digital image at regular intervals on the basis of thefrequency of the peak density value and means for comparing the computedreference value with a third reference value computed a specific periodof time ago and outputting the corrected second reference value if thedifference is less than a specific value and a specific reference valueinstead of the second reference value if the difference is larger thanthe specific value.
 15. An image forming apparatus which reads an imagein lines containing density information on each pixel, said imageforming apparatus comprising:means for forming a density histogramhaving a frequency of each density on the basis of the densityinformation about the digital image in a particular area; means fordetermining a peak density value at which the frequency of the densityhistogram peaks; means for computing a reference value for densitycorrection of the digital image on the basis of the frequency of thepeak density value; means for detecting a type of the image on the basisof the density histogram; means for correcting the reference value onthe basis of the detected type of the image; means for correcting thedensity information about the digital image on the basis of thereference value corrected at the correcting means; and means for formingan image on the basis of the corrected density information, wherein thepeak density determining means contains means for Pinpointing a whitepixel area and a black pixel area from the density histogram anddetermining the peak density values for the individual areas, one peakdensity for each area, wherein the reference value computing meanscontains:first judging means for judging whether or not the image hascontinued to be judged by the judging means to be a photograph area formore than a specific period of time; second judging means for judgingwhether or not the image has continued to be judged by the judging meansto be a character area for more than the specific period of time; andmeans for correcting the reference value on the basis of the judgingresults of the first and second judging means.
 16. An image formingapparatus according to claim 1, wherein the reference value correctingmeans contains:means for, when the image has continued to be detected bythe detecting means to be a photograph area during a period shorter thana specific period of time, correcting the reference value so that thereference value may be set at the reference value computed at the timewhen the image was detected to be a photograph area and then be set atthe reference value computed at the time when the image was detected tobe a character area; means for, when the image has continued to bedetected by the detecting means to be a photograph area during a periodlonger than the specific period of time, correcting the reference valueso that the reference value may be kept at the reference value computedat the time when the image was detected to be a photograph area; meansfor, when the image has continued to be detected by the detecting meansto be a character area during a period shorter than the specific periodof time, correcting the reference value so that the reference value maybe kept at the reference value computed at the time when the image wasdetected to be a character area; and means for, when the image hascontinued to be detected by the detecting means to be a character areaduring a period longer than the specific period of time, correcting thereference value so that the reference value may be kept at the referencevalue computed at the time when the image was detected to be a characterarea.